package fr.afcepf.atod19.dreamproject.service.implementation;

import fr.afcepf.atod19.dreamproject.business.interfaces.IBusinessCatalogue;
import fr.afcepf.atod19.dreamproject.dto.ReveDTO;
import fr.afcepf.atod19.dreamproject.dtoutils.EntityToDTOConverter;
import fr.afcepf.atod19.dreamproject.entity.Reve;
import fr.afcepf.atod19.dreamproject.service.interfaces.ICatalogueService;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Path("/catalogue")
public class CatalogueServiceImpl implements ICatalogueService{

    private IBusinessCatalogue businessCatalogue;

    @Override
    @Path("/getAllReves")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public List<ReveDTO> getAllReves() {
        List<Reve> reves = businessCatalogue.getAllReves();
        List<ReveDTO> reveDTOs = EntityToDTOConverter.getRevesDTO(reves);
        return reveDTOs;
    }

    public IBusinessCatalogue getBusinessCatalogue() {
        return businessCatalogue;
    }

    public void setBusinessCatalogue(IBusinessCatalogue businessCatalogue) {
        this.businessCatalogue = businessCatalogue;
    }
}
